<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of propierties
 *
 * @author 250-1-405
 */
class Property extends AppModel {

    var $name = "Property";
    var $actsAs = array('Logable' => array(
            'userModel' => 'User',
            'userKey' => 'user_id',
            'change' => 'full', // options are 'list' or 'full'
            'description_ids' => TRUE // options are TRUE or FALSE
            ));
    var $belongsTo = array(
        'Proyect' => array(
            'model' => 'Proyect'
        ),
        'City' => array(
            'model' => 'City'
        ),
    );
    var $hasOne = array(
        'PropertyAppraisal' => array(
            'model' => 'PropertyAppraisal'
        )
    );
    var $hasMany = array(
        'Owner' => array(
            'model' => 'Owner',
            'dependent' => true
        ),
        'TitleStudy' => array(
            'model' => 'TitleStudy',
            'dependent' => true,
        ),
        'TopographicMap' => array(
            'model' => 'TopographicMap',
        ),
        'PropertyRequirement' => array(
            'model' => 'PropertyRequirement',
            'dependent' => true
        ),
        'Construction' => array(
            'model' => 'Construction',
            'dependent' => true
        ), 'Annex' => array(
            'model' => 'Annex',
            'dependent' => true
        ),
        'QualityControl' => array(
            'model' => 'QualityControl',
            'dependent' => true
        ),
        'PropertyReview' => array(
            'model' => 'PropertyReview',
            'dependent' => true
        ),
        'EvaluationAppraisal' => array(
            'model' => 'EvaluationAppraisal',
            'dependent' => true
        ),
        'PropertyFinalReview' => array(
            'model' => 'PropertyFinalReview',
        )
    );
    var $validate = array(
        'nombre' => array(
            'notEmpty' => array(
                'rule' => 'notEmpty',
                'message' => 'Este campo no puede estar en blanco'
            ),
        ),
        'area_titulo' => array(
            'numeric' => array(
                'rule' => 'numeric',
                'message' => 'Solo valores numericos'
            ),
        ),
        'area_negociacion' => array(
            'numeric' => array(
                'rule' => 'numeric',
                'message' => 'Solo valores numericos'
            ),
        ),
        'matricula' => array(
            'notEmpty' => array(
                'rule' => 'notEmpty',
                'message' => 'Este campo no puede estar en blanco'
            ),
        ),
        'city_id' => array(
            'notEmpty' => array(
                'rule' => 'notEmpty',
                'message' => 'Tiene que elegir un municipo'
            ),
        ),
        'np_departamento' => array(
            'notEmpty' => array(
                'rule' => 'numeric',
                'message' => 'Solo valores numéricos'
            ),
        ),
        'np_municipio' => array(
            'notEmpty' => array(
                'rule' => 'numeric',
                'message' => 'Solo valores numéricos'
            ),
        ),
        'np_tipo' => array(
            'notEmpty' => array(
                'rule' => 'numeric',
                'message' => 'Solo valores numéricos'
            ),
        ),
        'np_vereda' => array(
            'notEmpty' => array(
                'rule' => 'numeric',
                'message' => 'Solo valores numéricos'
            ),
        ),
        'np_sector' => array(
            'notEmpty' => array(
                'rule' => 'numeric',
                'message' => 'Solo valores numéricos'
            ),
        ),
        'np_predio' => array(
            'notEmpty' => array(
                'rule' => 'numeric',
                'message' => 'Solo valores numéricos'
            ),
        ),
        'np_mejora' => array(
            'notEmpty' => array(
                'rule' => 'numeric',
                'message' => 'Solo valores numéricos'
            ),
        ),
    );
    var $virtualFields = array('suma_areas' => 'SUM(Property.area_titulo)', 'suma_valores' => 'SUM(Property.valor_negociacion)');

}

?>
